class TrieNode:
    def __init__(self, char: str):
        self.start: dict[str, TrieNode] = {}  # 以某字符开头的对象字典
        self.isword = False
        self.char = char

    def insert(self, word):
        if word[0] not in self.start:
            self.start[word[0]] = TrieNode(word[0])
        if len(word) > 1:
            self.start[word[0]].insert(word[1:])
        else:
            self.start[word].isword = True

    def word_is_resist(self, word: str) -> bool:
        if word[0] not in self.start: return False
        if len(word): return self.start[word[0]].word_is_resist(word[1:])
        return False


if __name__ == '__main__':
    root = TrieNode('')
    root.insert("hello")
    ...
    print(root.word_is_resist("hello"))
